// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using System;
using System.Linq;
using Elastic.Clients.Elasticsearch.Serialization;

namespace Elastic.Clients.Elasticsearch.IndexManagement;

[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.Json.IndexSegmentSortConverter))]
public sealed partial class IndexSegmentSort
{
#if NET7_0_OR_GREATER
	public IndexSegmentSort()
	{
	}
#endif
#if !NET7_0_OR_GREATER
	public IndexSegmentSort()
	{
	}
#endif
	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	internal IndexSegmentSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel)
	{
		_ = sentinel;
	}

	public Elastic.Clients.Elasticsearch.Fields? Field { get; set; }
	public System.Collections.Generic.ICollection<Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing>? Missing { get; set; }
	public System.Collections.Generic.ICollection<Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode>? Mode { get; set; }
	public System.Collections.Generic.ICollection<Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder>? Order { get; set; }
}

public readonly partial struct IndexSegmentSortDescriptor<TDocument>
{
	internal Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort Instance { get; init; }

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public IndexSegmentSortDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort instance)
	{
		Instance = instance;
	}

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public IndexSegmentSortDescriptor()
	{
		Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
	}

	public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor<TDocument>(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor<TDocument>(instance);
	public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor<TDocument> descriptor) => descriptor.Instance;

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor<TDocument> Field(Elastic.Clients.Elasticsearch.Fields? value)
	{
		Instance.Field = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor<TDocument> Field(params System.Linq.Expressions.Expression<System.Func<TDocument, object?>>[] value)
	{
		Instance.Field = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor<TDocument> Missing(System.Collections.Generic.ICollection<Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing>? value)
	{
		Instance.Missing = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor<TDocument> Missing(params Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing[] values)
	{
		Instance.Missing = [.. values];
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor<TDocument> Mode(System.Collections.Generic.ICollection<Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode>? value)
	{
		Instance.Mode = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor<TDocument> Mode(params Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode[] values)
	{
		Instance.Mode = [.. values];
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor<TDocument> Order(System.Collections.Generic.ICollection<Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder>? value)
	{
		Instance.Order = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor<TDocument> Order(params Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder[] values)
	{
		Instance.Order = [.. values];
		return this;
	}

	[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
	internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort Build(System.Action<Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor<TDocument>>? action)
	{
		if (action is null)
		{
			return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
		}

		var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor<TDocument>(new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance));
		action.Invoke(builder);
		return builder.Instance;
	}
}

public readonly partial struct IndexSegmentSortDescriptor
{
	internal Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort Instance { get; init; }

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public IndexSegmentSortDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort instance)
	{
		Instance = instance;
	}

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public IndexSegmentSortDescriptor()
	{
		Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
	}

	public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor(instance);
	public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor descriptor) => descriptor.Instance;

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Field(Elastic.Clients.Elasticsearch.Fields? value)
	{
		Instance.Field = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Field<T>(params System.Linq.Expressions.Expression<System.Func<T, object?>>[] value)
	{
		Instance.Field = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Missing(System.Collections.Generic.ICollection<Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing>? value)
	{
		Instance.Missing = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Missing(params Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing[] values)
	{
		Instance.Missing = [.. values];
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Mode(System.Collections.Generic.ICollection<Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode>? value)
	{
		Instance.Mode = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Mode(params Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode[] values)
	{
		Instance.Mode = [.. values];
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Order(System.Collections.Generic.ICollection<Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder>? value)
	{
		Instance.Order = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Order(params Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder[] values)
	{
		Instance.Order = [.. values];
		return this;
	}

	[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
	internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort Build(System.Action<Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor>? action)
	{
		if (action is null)
		{
			return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
		}

		var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance));
		action.Invoke(builder);
		return builder.Instance;
	}
}